package com.ls.markt.service.admin.impl;

import com.ls.markt.dao.admin.MatchMapper;
import com.ls.markt.model.admin.Matchs;
import com.ls.markt.repository.admin.MatchRepository;
import com.ls.markt.service.admin.MatchService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MatchServiceImpl implements MatchService {

    @Resource
    private MatchRepository matchRepository;

    @Resource
    private MatchMapper matchMapper;

    @Override
    public List<Matchs> listMatchs() {
        return matchMapper.findAll();
    }

    @Override
    public Matchs getMatchsById(Long id) {
        return matchRepository.getOne(id);
    }

    @Override
    public void saveMatchs(Matchs matchs) {
        matchRepository.save(matchs);
    }

    @Override
    public void removeMatchs(Long[] ids) {
        for (Long id: ids) {
            matchRepository.deleteById(id);
        }
    }
}
